//
//  MyWidgetModel.swift
//  TimMusic
//
//  Created by nkl on 2024/10/24.
//

import Foundation
import KLSwiftyKit

struct MyWidgetsModel: Codable {
    var datas: [MyWidgetItemModel]
}

struct MyWidgetItemModel: Codable {
    var uidString: String
    var date: Date
    var snapshot : Data?
    var itemModel: WidgetItemModel
}

enum WidgetType: String, EnumDecodable, EnumEncodable {
    case small = "Small"
    case medium = "Medium"

    public static var defaultValue: WidgetType {
        return .small // 设置默认值
    }
}

struct WidgetItemModel: Codable {
    var id: String
    var type: WidgetType
    var belong: String

    var fullName: String {
        [type.rawValue, belong, id].joined(separator: "_")
    }
}

struct WidgetsModel: Codable {
    var type: String
    var smalls: [WidgetItemModel]
    var mediums: [WidgetItemModel]
}
